import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/sysAuth/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/api/sysAuth/userInfo',
    method: 'get'
  })
}

export function getPermission() {
  return request({
    url: 'api/sysMenu/loginMenuTree',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/api/sysAuth/logout',
    method: 'post'
  })
}

export function getSysAuthCaptcha() {
  return request({
    url: '/api/sysAuth/captcha',
    method: 'get'
  })
}

export function getUsers(data) {
  return request({
    url: '/api/sysUser/page',
    method: 'post',
    data
  })
}

export function addUser(data) {
  return request({
    url: '/api/sysUser/add',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/api/sysUser/update',
    method: 'post',
    data
  })
}

export function deleteUser(id) {
  return request({
    url: '/api/sysUser/delete',
    method: 'post',
    data: { id }
  })
}

export function resetUser(id) {
  return request({
    url: '/api/sysUser/resetPwd',
    method: 'post',
    data: { id }
  })
}

export function changePwd(data) {
  return request({
    url: '/api/sysUser/changePwd',
    method: 'post',
    data
  })
}

export function getBaseInfo() {
  return request({
    url: '/api/sysUser/baseInfo',
    method: 'get'
  })
}

export function updateBaseInfo(data) {
  return request({
    url: '/api/sysUser/baseInfo',
    method: 'post',
    data
  })
}

export function uploadSignature(data) {
  return request({
    url: '/api/sysFile/uploadSignature',
    method: 'post',
    data
  })
}
